﻿<%@ Page Title="" Language="C#" MasterPageFile="~/AgentPage/CampusAgent.master" AutoEventWireup="true" CodeFile="AgentOrderList.aspx.cs" Inherits="AgentPage_AgentOrderList" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <link href="AgentOrderList.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
        .style1
        {
            width: 100%;
            margin:auto;
        }
        .style2
        {
            height: 20px;
        }
        .style3
        {
            height: 25px;
        }
        </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <div id="left">
        
        <table class="style1">
            <tr>
                <td>
                    <asp:Label ID="Label1" runat="server" Text="按条件查询"></asp:Label>
                </td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style3">
                    &nbsp;</td>
                <td class="style3">
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style3">
                    <asp:Label ID="Label_poststarttime" runat="server" Text="下单时间:"></asp:Label>
                </td>
                <td class="style3">
                    <asp:TextBox ID="TextBox_poststarttime" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="style2">
                    <asp:Label ID="Label_postendtime" runat="server" Text="至"></asp:Label>
                </td>
                <td class="style2">
                    <asp:TextBox ID="TextBox_postendtime" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td>
                    <asp:Label ID="Label_orderstarttime" runat="server" Text="预定时间:"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="TextBox_orderstarttime" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Label ID="Label_orderendtime" runat="server" Text="至"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="TextBox_orderendtime" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style2">
                    <asp:Label ID="Label_bookIDcard" runat="server" Text="预订人身份证号:"></asp:Label>
                </td>
                <td class="style2">
                    <asp:TextBox ID="TextBox_bookIDcard" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="style2">
                    </td>
                <td class="style2">
                    </td>
            </tr>
            <tr>
                <td>
                    &nbsp;</td>
                <td>
                    <asp:Button ID="Button_ok" runat="server" Text="确定" />
                </td>
            </tr>
            <tr>
                <td>
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td>
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td>
                    <asp:Label ID="Label2" runat="server" Text="订单操作:"></asp:Label>
                </td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td>
                    &nbsp;</td>
                <td>
                    <asp:Button ID="Button_del" runat="server" onclick="Button_del_Click" 
                        Text="取消选择订单" onclientclick="return confirm('您确认要取消选中的订单吗?');" 
                        CommandName="cancel" />
                        <%--<asp:LinkButton ID="LinkButton_del" runat="server" CommandName="cancel"  
                        OnClientClick="return confirm('您确认要取消选中的订单吗?);">取消选择订单</asp:LinkButton>--%>
                </td>
            </tr>
        </table>
        
    </div>
    
    <div id="right">
        <asp:Panel ID="Panel1" runat="server" ScrollBars="Auto">
       
        <ul>
        	<li>
                   <asp:GridView ID="GridView_order" runat="server" 
                        DataSourceID="SqlDataSource_orderlist" AutoGenerateColumns="False" 
                        DataKeyNames="订单号" AllowPaging="True" CellPadding="6" ForeColor="#333333" 
                        GridLines="Vertical" HorizontalAlign="Center" Width="150%" 
                       AllowSorting="True">
                        <AlternatingRowStyle BackColor="White" />
                        <Columns>
                            <asp:CommandField ShowSelectButton="True" />
                            <asp:BoundField DataField="订单号" HeaderText="订单号" ReadOnly="True" 
                                SortExpression="订单号" />
                            <asp:BoundField DataField="订单状态" HeaderText="订单状态" 
                                SortExpression="订单状态" />
                            <asp:BoundField DataField="宾馆名称" HeaderText="宾馆名称" 
                                SortExpression="宾馆名称" />
                            <asp:BoundField DataField="所在省份" HeaderText="所在省份" SortExpression="所在省份" />
                            <asp:BoundField DataField="城市" HeaderText="城市" 
                                SortExpression="城市" />
                            <asp:BoundField DataField="县/区" HeaderText="县/区" 
                                SortExpression="县/区" />
                            <asp:BoundField DataField="地址" HeaderText="地址" 
                                SortExpression="地址" />
                            <asp:BoundField DataField="电话" HeaderText="电话" 
                                SortExpression="电话" />
                            <asp:BoundField DataField="预定开始时间" HeaderText="预定开始时间" 
                                SortExpression="预定开始时间" />
                            <asp:BoundField DataField="至" HeaderText="至" 
                                SortExpression="至" />
                            <asp:BoundField DataField="下单时间" HeaderText="下单时间" SortExpression="下单时间" />
                        </Columns>
                        <EditRowStyle BackColor="#2461BF" />
                        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                        <RowStyle BackColor="#EFF3FB" />
                        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                        <SortedAscendingCellStyle BackColor="#F5F7FB" />
                        <SortedAscendingHeaderStyle BackColor="#6D95E1" />
                        <SortedDescendingCellStyle BackColor="#E9EBEF" />
                        <SortedDescendingHeaderStyle BackColor="#4870BE" />
                    </asp:GridView>
                    <asp:SqlDataSource ID="SqlDataSource_orderlist" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:ConnString %>" 
                        
                        
                        
                        
                        
                        
                        
                       
                       
                       SelectCommand="SELECT DISTINCT orderID AS 订单号, CASE orderstatus WHEN 0 THEN '已取消' WHEN 1 THEN '正常' WHEN 2 THEN '已过期' ELSE '状态错误' END AS 订单状态, hotelname AS 宾馆名称, province AS 所在省份, city AS 城市, county AS [县/区], address AS 地址, telephonenumber AS 电话, starttime AS 预定开始时间, endtime AS 至, ordertime AS 下单时间 FROM AgentOrderView WHERE agentID=@agentID AND(starttime &gt;= @starttime OR @starttime = '') AND (endtime &lt;= @endtime OR @endtime = '') AND (ordertime &gt;= @ordertime OR @ordertime = '') AND (ordertime &lt;= @ordertime2) AND (orderID IN (SELECT orderID FROM OrderStudent WHERE (IDcard = @IDcard) OR (@IDcard = ''))) OR (starttime &gt;= @starttime OR @starttime = '') AND (endtime &lt;= @endtime OR @endtime = '') AND (ordertime &gt;= @ordertime OR @ordertime = '') AND (orderID IN (SELECT orderID FROM OrderStudent AS OrderStudent_1 WHERE (IDcard = @IDcard) OR (@IDcard = ''))) AND (@ordertime2 = '') ORDER BY 下单时间 DESC">
                        <SelectParameters>
                            <asp:SessionParameter Name="agentID" SessionField="userId" />
                            <asp:ControlParameter ControlID="TextBox_orderstarttime" Name="starttime" 
                                PropertyName="Text" Type="String" DefaultValue=" " />
                            <asp:ControlParameter ControlID="TextBox_orderendtime" Name="endtime" 
                                PropertyName="Text" Type="String" DefaultValue=" " />
                            <asp:ControlParameter ControlID="TextBox_poststarttime" Name="ordertime" 
                                PropertyName="Text" Type="String" DefaultValue=" " />
                            <asp:ControlParameter ControlID="TextBox_postendtime" Name="ordertime2" 
                                PropertyName="Text" Type="String" DefaultValue=" " />
                            <asp:ControlParameter ControlID="TextBox_bookIDcard" DefaultValue=" " 
                                Name="IDcard" PropertyName="Text" Type="String" />
                        </SelectParameters>
                    </asp:SqlDataSource>
             
            </li>
            <li >
                
                    <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
                        AllowSorting="True" AutoGenerateColumns="False" CellPadding="4" 
                        DataKeyNames="身份证号" DataSourceID="SqlDataSource_showorderstudent" 
                        ForeColor="#333333" GridLines="None" Width="100%">
                        <AlternatingRowStyle BackColor="White" />
                        <Columns>
                            <asp:BoundField DataField="学生姓名" HeaderText="学生姓名" SortExpression="学生姓名" />
                            <asp:BoundField DataField="出生日期" HeaderText="出生日期" SortExpression="出生日期" />
                            <asp:BoundField DataField="性别" HeaderText="性别" SortExpression="性别" />
                            <asp:BoundField DataField="电话号码" HeaderText="电话号码" SortExpression="电话号码" />
                            <asp:BoundField DataField="身份证号" HeaderText="身份证号" ReadOnly="True" 
                                SortExpression="身份证号" />
                        </Columns>
                        <EditRowStyle BackColor="#2461BF" />
                        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                        <RowStyle BackColor="#EFF3FB" />
                        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                        <SortedAscendingCellStyle BackColor="#F5F7FB" />
                        <SortedAscendingHeaderStyle BackColor="#6D95E1" />
                        <SortedDescendingCellStyle BackColor="#E9EBEF" />
                        <SortedDescendingHeaderStyle BackColor="#4870BE" />
                    </asp:GridView>
                    <asp:SqlDataSource ID="SqlDataSource_showorderstudent" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:ConnString %>" 
                        
                        
                        SelectCommand="SELECT DISTINCT name AS '学生姓名', birthday AS '出生日期', sex AS '性别', telephonenumber AS '电话号码', IDcard AS '身份证号' FROM StudentOrderStudentView WHERE (orderID = @orderID)">
                        <SelectParameters>
                            <asp:ControlParameter ControlID="GridView_order" Name="orderID" 
                                PropertyName="SelectedValue" Type="String" />
                        </SelectParameters>
                    </asp:SqlDataSource>
                
                
            </li>
            <li>
           
                <asp:SqlDataSource ID="SqlDataSource_showorderoom" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:ConnString %>" 
                    SelectCommand="SELECT [roomname] as '房间名', [roomsize] as '房间大小', [price]  as '价格'FROM [OrderRoom] WHERE ([orderID] = @orderID)">
                    <SelectParameters>
                        <asp:ControlParameter ControlID="GridView_order" Name="orderID" 
                            PropertyName="SelectedValue" Type="String" />
                    </SelectParameters>
                </asp:SqlDataSource>
                <asp:SqlDataSource ID="SqlDataSource_priceall" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:ConnString %>" 
                    SelectCommand="SELECT CASE WHEN DATEDIFF(DAY,starttime,endtime)=0 THEN SUM(price)  ELSE SUM(price)*DATEDIFF(DAY,starttime,endtime)END  AS '总价' 
FROM OrderRoom,OrderTable
where OrderRoom.orderID=OrderRoom.orderID and  (OrderRoom.orderID = @ORDERID)
group by OrderRoom.orderID,starttime,endtime ">
                    <SelectParameters>
                        <asp:ControlParameter ControlID="GridView_order" Name="ORDERID" 
                            PropertyName="SelectedValue" />
                    </SelectParameters>
                </asp:SqlDataSource>
                
               
                        <asp:DetailsView ID="DetailsView_count" runat="server" AutoGenerateRows="False" 
                            DataSourceID="SqlDataSource_priceall" Height="50px" Width="125px">
                            <Fields>
                                <asp:BoundField DataField="总价" HeaderText="总价" ReadOnly="True" 
                                    SortExpression="总价" />
                            </Fields>
                        </asp:DetailsView>
                        <asp:GridView ID="GridView2" runat="server" AllowPaging="True" 
                    AutoGenerateColumns="False" CellPadding="4" 
                    DataSourceID="SqlDataSource_showorderoom" ForeColor="#333333" GridLines="None" 
                    Width="50%">
                            <AlternatingRowStyle BackColor="White" />
                            <Columns>
                                <asp:BoundField DataField="房间名" HeaderText="房间名" SortExpression="房间名" />
                                <asp:BoundField DataField="房间大小" HeaderText="房间大小" SortExpression="房间大小" />
                                <asp:BoundField DataField="价格" HeaderText="价格" SortExpression="价格" />
                            </Columns>
                            <EditRowStyle BackColor="#2461BF" />
                            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                            <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                            <RowStyle BackColor="#EFF3FB" />
                            <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                            <SortedAscendingCellStyle BackColor="#F5F7FB" />
                            <SortedAscendingHeaderStyle BackColor="#6D95E1" />
                            <SortedDescendingCellStyle BackColor="#E9EBEF" />
                            <SortedDescendingHeaderStyle BackColor="#4870BE" />
                </asp:GridView>
                 
            </li>
        </ul>
         </asp:Panel>
    </div>

</asp:Content>

